The HTML class, derived from File, is a top-level window that renders HTML in a text widget. It uses the HTML library written by Stephen Uhler of Sun Microsystems, which supports all the features of HTML 2.0. There is currently no support in Tycho for HTTP hyperlink references, so you cannot within Tycho directly read documents on the internet. A sample document illustrates the HTML tags that are supported.
The HTML class is used for all Tycho documentation. It supports an extension of HTML with embedded Tcl scripts. If the user double clicks on a script, the Tcl script is executed in the global namespace.
You may create an instance of the HTML class as follows:
::tycho::HTML .e -file $TYCHO/kernel/doc/introduction.html
.e centerOnScreen
The top-level HTML class window
is implemented by packing into it a megawidget that implements
the editor itself.
This megawidget, the HTMLText class, can be used
stand-alone inside any other widget or window.
For example, the Tycho welcome window contains an
instance of HTMLText.
We can create an instance of the HTMLText megawidget in its own top-level
window as follows:
HTMLText Class
::tycho::TopLevel .t
::tycho::HTMLText .t.t -width 40 -height 10 -scrollbar 0 -html {
<h1>Sample HTML Header</h1>
Sample HTML body.
}
pack .t.t
.t centerOnScreen
delete object .t
::tycho::TopLevel .p
::tycho::HTMLText .p.t \
-html "<h1>Initial header in the HTML widget</h1>" \
-width 60 \
-scrollbar 0 \
-height 20
pack .p.t
.p centerOnScreen
.p.t configure -readonly no
.p.t readFile $ptolemy/tycho/kernel/doc/rationale.html